# Demonstrates the use of Font Dialog box and how it can be applied to an object
import sys
from PySide import QtGui, QtCore

class Window(QtGui.QWidget):
    def __init__(self):
        super(Window, self).__init__()

        # Create a button to open the font dialog
        self.btn = QtGui.QPushButton("Font Dialog", self)
        self.btn.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        self.btn.move(20, 20)
        self.btn.clicked.connect(self.showFontDialog)

        # Create a label object for font changing
        self.lbl = QtGui.QLabel("This is a la belle", self)
        self.lbl.setGeometry(30, 30, 150, 50)
        self.lbl.move(20, 50)


        self.setGeometry(200, 200, 200, 100)
        self.setWindowTitle("Font Dialog")

    def showFontDialog(self):
        font, ok = QtGui.QFontDialog.getFont()
        if ok:
            self.lbl.setFont(font)

if __name__ == "__main__":
    appObject = QtGui.QApplication(sys.argv)
    ex = Window()
    ex.show()
    sys.exit(appObject.exec_())